package com.yanqu.road.server.cmd.activity.liondance;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.LionDanceProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.activity.ActivityMgr;
import com.yanqu.road.server.manger.activity.liondance.LionDanceMgr;
import com.yanqu.road.server.protocol.GameErrorCode;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_LION_DANCE_CHECK_APPLY_STATE, desc = "检查申请状态")
public class LionDanceCheckApplyStatusCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        // 没有活动
        if (!ActivityMgr.activityInShowTime(LionDanceMgr.getActivityInfo()) || LionDanceMgr.getConfig() == null) {
            ret = GameErrorCode.E_ACTIVITY_OVER_TIME;
            return;
        }
        LionDanceProto.LionDanceCheckApplyStatusReqMsg reqMsg = LionDanceProto.LionDanceCheckApplyStatusReqMsg.parseFrom(packet.getBytes());
        LionDanceProto.CrossLionDanceCheckApplyStatusReqMsg.Builder crossReq = LionDanceProto.CrossLionDanceCheckApplyStatusReqMsg.newBuilder();
        crossReq.setActivityId(LionDanceMgr.getActivityId());
        crossReq.setReq(reqMsg.toBuilder());
        player.sendPacket(Protocol.C_LION_DANCE_CHECK_APPLY_STATE, crossReq);
    }

    @Override
    public void sendData(GamePlayer player) {

    }
}
